import type { RouterConfig } from "nuxt/schema";
import app from "../app.vue";
// 添加自定义路由，与vue的路由配置格式相同

// export default <RouterConfig>{
//   routes: (_routes) => [
//     ..._routes,
//     {
//       name: "users",
//       path: "/users",
//       component: () => import("../pages/users.vue"),
//       children: [
//         {
//           name: "roles",
//           path: "roles",
//           component: () => import("../pages/users/roles.vue"),
//         },
//       ],
//     },
//   ],
// };

export default {
  routes: (_routes) => [
    {
      name: "home",
      path: "/",
      component: app,
    },
    {
      name: "users",
      path: "/users",
      component: () => import("../pages/users.vue"),
      children: [
        {
          name: "roles",
          path: "roles",
          component: () => import("../pages/users/roles.vue"),
        },
      ],
    },
    {
      name: "about",
      path: "/about",
      component: () => import("../pages/about.vue"),
    },
    {
      name: "courses",
      // 自定义路由
      path: "/zzz",
      component: () => import("../pages/courses/[id].vue"),
    },
    {
      name: "coursesIndex",
      path: "/courses",
      component: () => import("../pages/courses/index.vue"),
    },
  ],
} satisfies RouterConfig;
